#include <bits/stdc++.h>
using namespace std;

int n,q;
long long a[8005],b[8005];
int tans[200005],ti = 0,stat;
int bi[8005];

int main()
{
	freopen("sort.in","r",stdin);
	freopen("sort.out","w",stdout);
	cin >> n >> q;
	for(int i = 1; i <= n; i++)
	{
		cin >> a[i];
	}
	for(int k = 1; k <= q; k++)
	{
		int excut;
		cin >> excut;
		if(excut == 1)
		{
			int x;
			long long v;
			cin >> x >> v;
			a[x] = v;
		}
		if(excut == 2)
		{
			cin >> stat;
			for(int i = 1; i <= n; i++)
			{
				b[i] = a[i];
				bi[i]= i;
			}
			for (int i = 2; i <= n; i++){
				for (int j = i; j >= 2; j--){
					if (b[j] < b[j-1]){
						int t = b[j-1];
						b[j-1] = b[j];
						b[j] = t;
						int u = bi[j-1];
						bi[j-1] = bi[j];
						bi[j] = u;
						if(stat == bi[j]) 
						{
							stat = bi[j-1];
						}
						if(stat == bi[j-1])
						{
							stat = bi[j];
						}
					}
				}
			}
			++ti;
			tans[ti] = stat;
		}
	}
	for(int i = 1; i <= ti; i++)
	{
		cout << tans[i] << endl;
	}
}
